#pragma once
#include<iostream>
using namespace std;


template<class T>
class TwoWayLinkList {
private:
	class Node {
	public:
		T item;
		Node* pre;
		Node* next;
		Node(Node* pre, T t, Node* next) {
			this->item = t;
			this->pre = pre;
			this->next = next;
		}
	};

public:
	Node* first;
	Node* last;
	int N;

	TwoWayLinkList() {
		this->first = new Node(NULL, (T)"", NULL);
		this->last = new Node(NULL, (T)"", NULL);
		this->N = 0;
	}
	~TwoWayLinkList() {
		if (first != NULL) {
			delete first;
			first = NULL;
		}
		else if (last != NULL) {
			delete last;
			last = NULL;
		}
	}


};


